<?php

namespace App\Http\Requests\Home;

use App\Http\Requests\ApiRequest;

/**
 * @property int product_category_id
 * @property int per_page
 * @property string keyword
 */
class ProductionIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'product_category_id' => 'sometimes|numeric',
            'keyword'            => 'sometimes|string'
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'product_category_id.*' => '产品的种类必须是数字',
            'keyword.*'            => '产品标题或型号必须是字符串',
        ];
    }
}
